package services

import (
	"imooc.com/demo_pms/dao"
	"imooc.com/demo_pms/datasources"
	"imooc.com/demo_pms/models"
)

type PayrollService interface {
	Create(dataList []models.Payroll) (int, error)
	Update(data *models.Payroll, cols []string) error
}

type payrollService struct {
	dao *dao.PayrollDao
}

func NewPayrollService() PayrollService {
	return &payrollService{
		dao: dao.NewPayrollDao(datasources.InstanceDbMaster())}
}

func (p *payrollService) Create(dataList []models.Payroll) (int, error) {
	return p.dao.Create(dataList)
}

func (p *payrollService) Update(data *models.Payroll,
	cols []string) error {
	return p.dao.Update(data, cols)
}
